package makeFancyString;

public class Solution {
    public String makeFancyString(String s) {
        // 当前字符和前两个字符相同的话 就跳过
        StringBuilder sb = new StringBuilder();
        for (int i = 0; i < s.length(); i++) {
            if(i>=2) {
                if(s.charAt(i) == s.charAt(i-1)&&s.charAt(i) == s.charAt(i-2)) {
                    continue;
                }
                sb.append(s.charAt(i));
            } else {
                sb.append(s.charAt(i));
            }
        }
        return sb.toString();
    }
}
